// -*- c++ -*-
/*
 * C++ <new> header
 *
 * This file is part of PanicOS.
 *
 * PanicOS is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * PanicOS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with PanicOS.  If not, see <https://www.gnu.org/licenses/>.
 */

#ifndef _LIBCPP_NEW
#define _LIBCPP_NEW

#include <cstddef>

// new
[[nodiscard]] void *operator new(std::size_t count);
[[nodiscard]] void *operator new[](std::size_t count);

// placement new
[[nodiscard]] constexpr void *operator new(std::size_t count, void *ptr) noexcept {
	return ptr;
}

[[nodiscard]] constexpr void *operator new[](std::size_t count, void *ptr) noexcept {
	return ptr;
}

// delete
void operator delete(void *ptr) noexcept;
void operator delete[](void *ptr) noexcept;

namespace std {
	// new handler
	typedef void (*new_handler)();
	std::new_handler get_new_handler() noexcept;
	std::new_handler set_new_handler(std::new_handler new_p) noexcept;
} // namespace std

#endif
